<template>
<div>
  <div class="timeLineBox">
  <el-timeline>
    <el-timeline-item v-for="(item,index) in list" :key="index" :timestamp="item.month" placement="top" icon="el-icon-time">
      <el-card>
        <div class="item" v-for="art in item.list" :key="art._id">
        <h4 @click="goDetail(art._id)">{{art.title}}</h4>
        <p>{{art.nickName}} 提交于 {{$dayjs(art.createDate).format('YYYY-MM-DD hh:mm:ss')}}</p>
        </div>
      </el-card>
    </el-timeline-item>
  </el-timeline>
  </div>
</div>
</template>

<script>
  export default {
    data() {
      return {
        list:[]
      }
    },
    methods:{
      goDetail(id){
        // 跳转页面并且 重新打开一个窗口
        window.open('#/artDetail/' + id)
      }
    },
    async created() {
      const {data} = await this.$http.get('/articleAllShow')
      this.list=data.list
    },
  }
</script>
<style lang="less">
.el-timeline-item__icon{
  font-size: 35px !important;
  color: #333;
}
.el-timeline-item__timestamp.is-top{
  font-size: 24px;
  color: #333;
  margin-left: 5px;
  transform: translateY(-6px);
}
.el-card__body{
  h4{
    margin: 0;
    margin-bottom: 6px;
    font-weight: normal;
    cursor: pointer;
  }
  h4:hover{
    color:  deeppink;
  }
  p{
    font-size: 13px;
    color: #888;
  }
}
</style>


<style lang="less" scoped>
li{
  list-style-type:none
}
.timeLineBox{
  width: 800px;
  box-sizing: border-box;
  padding: 50px 80px 50px 150px;
  .item{
    margin-bottom: 15px;
  }
}
</style>